package cn.qicaiwang.open.qxyApi.mapper;

import cn.qicaiwang.open.qxyApi.entity.EnterpriseInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface EnterpriseInfoMapper  extends BaseMapper<EnterpriseInfo> {

        @Select("SELECT * FROM EnterpriseInfo WHERE company_name = #{companyName}")
        EnterpriseInfo selectByCompanyName(@Param("companyName") String companyName);
        /**​
         * 通过userId查询企财查包次数
         * @param userId 用户ID
         * @return 报告次数（如果没有记录返回null）
         */
        @Select("SELECT package_count FROM fa_user WHERE status = 'normal' AND id = #{userId}")
        Integer getPackageCount(@Param("userId") String userId);



        /**
         * 更新企财查包次数
         * @param userId 用户ID
         * @param count 更新后的次数
         */
        @Update("UPDATE fa_user SET package_count = #{count} WHERE status = 'normal' AND id = #{userId}")
        void updatePackageCount(@Param("userId") String userId, @Param("count") Integer count);

}
